﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using zhangmenren.IService;
using zhangmenren.Models;
using zhangmenren.Repository;

namespace zhangmenren.Service
{
    public class ItemService : IItemService
    {
        private ItemRepository itemRepository = new ItemRepository();
        public Task<int> Add(ItemEntity entity)
        {
            return Task.FromResult(itemRepository.Add(entity));
        }

        public Task<IEnumerable<ItemEntity>> FindById(int id)
        {
            return Task.FromResult(itemRepository.FindById(id));
        }

        public Task<IEnumerable<ItemEntity>> FindByProductId(int productId)
        {
            return Task.FromResult(itemRepository.FindByProductId(productId));
        }
    }
}
